#pragma once

#include <deque>
#include <vector>
#include <map>
#include "ICC_Timer_Handler.h"
#include "GameBase.h"
#include "CClient.h"
#include "def.h"
#include "LogicData.h"
#include "MarkupSTL.h"
#include "1700_account.pb.h"

class CHost;
class CGameServer : public BYTimerOject
{
public:
	CGameServer();
	virtual ~CGameServer();
public:
	virtual bool InitGame();
	virtual int OnBYTimeOut(int Timerid);
	int ProcessPacket(SocketHandler * pHandler, NETInputPacket* inputPkg);
	bool ReadCommonConf(const char* strxml);

public:
	void ProcUpdateAccountToken(SocketHandler* pHandler, NETInputPacket* inputPkg);
	void ProcGetAccount(SocketHandler* pHandler, NETInputPacket* inputPkg);
	void ProcGetAccountByUuid(SocketHandler* pHandler, NETInputPacket* inputPkg);
	void ProcGetAccountByUid(SocketHandler* pHandler, NETInputPacket* inputPkg);
	void ProcGenLoginToken(SocketHandler* pHandler, NETInputPacket* inputPkg);
	void ProcVerifyLoginToken(SocketHandler* pHandler, NETInputPacket* inputPkg);
	void ProcInGameQueryRsp(SocketHandler* pHandler, NETInputPacket* inputPkg);
public:
	CHost* m_pHost;
private:
	std::map<std::uint32_t, stCacheLoginInfo> m_cacheAccountInfo;
	std::multimap<std::uint64_t, std::uint32_t> m_cacheQueue;
	std::uint32_t genSeq(void);
	int procTimerLoginCacheCheck(void);
	void procTimeoutCache(const std::uint32_t seq, const std::uint64_t proctime);
};

